<?php

/*
    Author: Mike
    Date:2013/06/17
    企业购买
*/

define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');

    if(isset($_POST['username']))
    {
        $code = !empty($_POST['code']) ? compile_str(trim($_POST['code'])) : '';
        include_once('includes/cls_captcha.php');
        $validator = new captcha();
        $validator->session_word = 'captcha_login';
    
        $username = isset($_POST['username'])   ? compile_str(trim($_POST['username']))    : '';
        $phone = isset($_POST['phone'])   ? compile_str(trim($_POST['phone']))  : 0;
        $tel = isset($_POST['tel'])   ? compile_str(trim($_POST['tel']))  : 0 ;
        $company_name = isset($_POST['company_name'])   ? compile_str(trim($_POST['company_name']))    : '' ;
        $buying_demand = isset($_POST['buying_demand'])   ? compile_str(trim($_POST['buying_demand']))    : '';

        if($validator->check_word($_POST['code'])){
            $post_time = date("Y-m-d H:i:s",time());
            $sql="insert into".$GLOBALS['ecs']->table('company_order')."(username,phone,tel,company_name,buying_demand,post_time)".
            "values ('$username','$phone','$tel','$company_name','$buying_demand','$post_time')";
            mysql_query($sql);
            echo "success";
        }else{
            echo "error";
        }

    }


    
    
    
    
?>